package org.chen.common.flight;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

// ==================== 2. 往返航班信息 ====================
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class RoundTripFlightInfo {
    private Long id;
    // 基础信息
    private String itineraryId;
    private Integer priceIndex;

    private Integer transferCount;         // 中转次数
    private Integer crossDays;
    
    // 去程信息
    private OneWayFlightInfo outboundFlight;
    
    // 返程信息
    private OneWayFlightInfo returnFlight;
    
    // 价格信息（往返总价）
    private BigDecimal adultTotalPrice;    // 成人总价
    private BigDecimal adultPrice;    // 成人不含税
    private BigDecimal adultTax;    // 成人税
    private BigDecimal childTotalPrice;    // 儿童总价
    private BigDecimal childPrice;    // 儿童不含税
    private BigDecimal childTax;    // 儿童税
    private BigDecimal infantTotalPrice;   // 婴儿总价
    private BigDecimal infantPrice;   // 婴儿总价
    private BigDecimal infantTax;   // 婴儿总价
    private String currency;
    private Integer miseryIndex;
    private Integer ticketCount;
    
    // 往返特征
    private Boolean isAllDirectFlight;     // 往返都是直飞
    private Integer totalTransferCount;    // 总中转次数
    private String cabinClass;             // 舱位
    private String baggageInfo;            // 行李信息
    private List<String> purchaseNotes;    // 购买须知
    
    // 系统信息
    private LocalDateTime lastUpdated;
    
    public RoundTripFlightInfo() {
        this.currency = "CNY";
        this.totalTransferCount = 0;
        this.isAllDirectFlight = true;
        this.lastUpdated = LocalDateTime.now();
    }
    
    // 获取路线描述
    public String getRouteDescription() {
        if (outboundFlight != null && returnFlight != null) {
            return String.format("%s-%s-%s", 
                outboundFlight.getDepartureCityCode(),
                outboundFlight.getArrivalCityCode(),
                returnFlight.getArrivalCityCode());
        }
        return "";
    }
}